[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 rmdir()                 Delete a Directory

 #include   <dir.h>                      Required for declarations only

 int        rmdir(pathname);
 const char *pathname;                   Name of Path name to be removed

    rmdir() removes a directory specified by 'pathname'. A directory
    cannot be removed if it is either the root directory or the current
    directory, of if it contains any files or subdirectories.

       Returns:     0, if successful; -1 is returned on error and 'errno'
                    (defined in <errno.h>) is set to:

                     EACCES     Permission denied
                     ENOENT     Path name not found

   -------------------------------- Example ---------------------------------

    The following statements delete a directory and prints a message.

           #include <dir.h>

           int result1;

           main()
           {
                 if ((result1 = rmdir("/tstmkd")) < 0)
                     printf("error removing directory");
                 else
                     printf("tstmkd deleted");
           }


See Also: chdir() mkdir()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson